#include<iostream>
#include<cstdio>
using namespace std;
int a[8005];
int n,q;
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin >> n >> q;
	for(int i = 1;i <= n;i++)
	{
		cin >> a[i];
	}
	for(int i = 1;i <= q;i++)
	{
		int p;
		cin >> p;
		if(p == 1)
		{
			int x,v;
			cin >> x >> v;
			a[x] = v;
		}
		if(p == 2)
		{
			int x;
			cin >> x;
			int cnt = 0;
			for(int i = 1;i < x;i++)
			if(a[i] <= a[x])
			cnt++;
			for(int i = x+1;i <= n;i++)
			if(a[i] < a[x])
			cnt++;
			cout << cnt+1 << endl;
		}
	}
	return 0;
}
